package com.xiaoyi.ui.fragment.base;

import android.content.Context;
import android.support.v4.app.Fragment;

import com.xiaoyi.ui.view.lodingdialog.LoadingDialog;
import com.xiaoyi.ui.view.lodingdialog.LoadingDialog2;

import me.yokeyword.fragmentation.SupportFragment;
import me.yokeyword.fragmentation_swipeback.SwipeBackFragment;

/**
 * 懒加载
 */
public abstract class BaseSwipeBackFragment extends SwipeBackFragment {

    private  LoadingDialog loadingDialog;
    public void showLoadDialog(Context context  ) {
        if (loadingDialog == null) {
            loadingDialog = new LoadingDialog(context);
        }
        loadingDialog.show();
        loadingDialog.setMsg("加载中");
    }

    public void hideLoadDialog() {
        if (loadingDialog != null) {
            loadingDialog.dismiss();
        }
    }


    private LoadingDialog2 loadingDialog2;
    public void showLoadDialog2(Context context  ) {
        if (loadingDialog2 == null) {
            loadingDialog2 = new LoadingDialog2(context);
        }
        loadingDialog2.show();
        loadingDialog2.setMsg("加载中");
    }

    public void hideLoadDialog2() {
        if (loadingDialog2 != null) {
            loadingDialog2.dismiss();
        }
    }
}
